import Vue from 'vue'
// 注册一个全局自定义指令 `v-has`
var self =this;
Vue.directive('has', {
  // 当被绑定的元素插入到 DOM 中时触发bind钩子
  inserted: function (el, binding) {
    if (!permissionJudge(binding.value)) {
      el.parentNode.removeChild(el);
    }
  }
});

function permissionJudge(value) {
		
      let list = sessionStorage.getItem('menuBtnList');
	  let rep = JSON.parse(list);
      for (let item of rep) {
        if (item.url == value) {
          return true;
        }
      }
      return false;
    }

export {has}